package cn.flant.db.exec;

import java.sql.Connection;
import java.sql.SQLException;

import cn.flant.db.mgr.ConnectionManager;

public class DefaultDbExecutor extends BasicExecutor {
	private ConnectionManager mgr = null;

	public DefaultDbExecutor(ConnectionManager mgr) {
		this(mgr, 0);
	}

	public DefaultDbExecutor(ConnectionManager mgr, int timeout) {
		super(timeout);
		this.mgr = mgr;
	}

	@Override
	protected Connection getConnection() throws SQLException {
		return mgr.getConnection();
	}

	@Override
	protected void closeConnection(Connection conn) {
		if (conn != null) {
			mgr.closeConnection(conn);
		}
	}
}
